package com.xxx.files;

import java.io.File;
import java.io.IOException;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/7/23  13:39
 * @Copyright
 */
public class fileDome {
    public static void main(String[] args) throws IOException {
        //m1();
        //m2();
       // m3();
//        File file1 = new File("C:\\Users\\admin\\Desktop\\Git\\a");
//        file1.mkdir();

         File file = new File("F:\\");
        System.out.println(file.getTotalSpace() / 1024 / 1024 /1024);
        System.out.println(file.getFreeSpace() / 1024 / 1024);
        System.out.println(file.getUsableSpace() / 1024 / 1024);


    }

    private static void m3() throws IOException {
        File file1 = new File("F:\\讲课项目\\JAVA\\JavaSe\\sd.txt");
        System.out.println(  file1.createNewFile());

        File file2 = new File("F:\\讲课项目\\JAVA\\JavaSe\\sb.txt");
        file2.renameTo(file2);

        file2.delete();
    }

    private static void m2() {
        File file1 = new File("F:\\讲课项目\\JAVA\\JavaSe\\sd.jpg");
        System.out.println("文件名："+file1.getName());
        System.out.println("文件路径："+file1.getPath());
        System.out.println("修改时间："+file1.lastModified());
        System.out.println("文件大小："+file1.length());
    }

    private static void m1() {
        File file = new File("F:\\讲课项目\\JAVA\\JavaSe");

        File file1 = new File("F:\\讲课项目\\JAVA\\JavaSe\\sd.jpg");
        new File(file,"sdjpg");
    }
}
